package offer_test_20;

import java.util.Stack;

import struct.LinkedList;
import struct.LinkedList.Data;
public class five_LinkNode {
public static void main(String[] args) throws Exception {
	LinkedList list=new LinkedList();
	list.insertFirst("A");  
    list.insertFirst("B");  
    list.insertFirst("C");  
    list.insertFirst("D");  
    Stack<String> stack=new Stack<String>();
    String str;
    Data head=list.getFirst();
    while(head!=null){
    	str=(String) head.getObj();
    	stack.push(str);
    	head=head.getNext();
    }
    while(!stack.isEmpty()){
    	System.out.print(stack.pop());
    }

}
}
